package com.example.controller;


import com.example.common.Result;
import com.example.entity.User;
import com.example.service.impl.AdminServiceImpl;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/User")
public class UserController {

    @Autowired
    private UserService UserService;

    @Autowired
    AdminServiceImpl adminServiceImpl;



    @PostMapping("/add")
    public Result add(@RequestBody User User){

        UserService.save(User);
        return Result.success();
    }

    @PutMapping("/edit")
    public Result edit(@RequestBody User User){

        UserService.updateById(User);
        return Result.success();
    }

    @DeleteMapping("/remove/{id}")
    public Result removeByid(@PathVariable int id){
        UserService.removeById(id);
        return Result.success();
    }

}
